package com.tj.bo.common.conf.enums;

import com.fqgj.exception.enums.ErrorCodeEnum;
import org.springframework.http.HttpStatus;

/**
 * @program: binary-option
 * @description
 * @author: binary
 * @create: 2020-06-10 18:28
 **/
public enum BasicErrorCodeEnum implements ErrorCodeEnum {

    SUCCESS(0, "SUCCESS",HttpStatus.OK),
    INTERNAL_SERVER_ERROR(90000, "Internal server error", HttpStatus.INTERNAL_SERVER_ERROR),
    PARAM_VALID_ERROR(90001, "Parameter validation failed", HttpStatus.INTERNAL_SERVER_ERROR),
    PARAM_RESOLVE_ERROR(90002, "Parameter resolution exception", HttpStatus.INTERNAL_SERVER_ERROR);


    BasicErrorCodeEnum(Integer code, String desc, HttpStatus httpStatus) {
        this.code = code;
        this.desc = desc;
        this.httpStatus = httpStatus;
    }

    private Integer code;

    private String desc;

    private HttpStatus httpStatus;


    public Integer getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return this.getDesc();
    }

    public BasicErrorCodeEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public BasicErrorCodeEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public HttpStatus getHttpStatus() {
        return httpStatus;
    }

    public BasicErrorCodeEnum setHttpStatus(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
        return this;
    }
}
